const http = require('http');
var fs = require('fs');
var events = require('events');
var eventEmitter = new events.EventEmitter();

eventEmitter.on('end',function(data){
    console.log('服务器响应成功',data)
})
http.createServer(function (request, response) {
  response.writeHead(200, { 'Content-Type': 'text/plain' });
  fs.readFile(__dirname + '/log.txt', function (err, data) {
    if (err) return console.error(err);
    eventEmitter.emit('end','asdasd');
    response.end(data.toString());
  });
}).listen(8082);
console.log('Server running at http://127.0.0.1:8082/');